/**
 * @author:李雄
 * @ClassName:Demo1
 * @Description:父类子类有相同变量的访问顺序
 * @createTime:2022-08-07 12:53
 */
public class Demo1 {
    public static void main(String[] args) {
        Object o = new Dog();
        Animals o1 = (Animals) o;
        System.out.println(o1.name);
    }
}

class Animals {
    public String name = "动物大全";
    private int age=20;
    public Animals(){
        System.out.println("我是父类");
    }
    public void run() {
        System.out.println(name + "跑不的方式！");
    }
}

class Dog extends Animals {

    public void run() {
        System.out.println(name + "四只脚跑哦！");
        System.out.println();
    }
    public Dog(){

    }
}